package com.lcxw.hxzb.friendcircle.project.system.FeignService;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 腾讯IM系统的接口调用
 */


@FeignClient(name = "hxzb-im", url = "https://console.tim.qq.com/v4")
public interface ImManager {

    /**
     * 1、通过后台系统推送群消息，普通消息
     */
    @RequestMapping(method = RequestMethod.POST, value = "/group_open_http_svc/send_group_msg?sdkappid={sdkappid}&identifier={identifier}&usersig={usersig}&random={random}&contenttype=json")
    String sendGroupMsg(@PathVariable("sdkappid") long sdkappid,
                        @PathVariable("identifier") String identifier,
                        @PathVariable("usersig") String usersig,
                        @PathVariable("random") long random,
                        @RequestBody JSONObject requestBody
    );


    /**
     * 2、普通消息
     */
    @RequestMapping(method = RequestMethod.POST,value = "/openim/sendmsg?sdkappid={sdkappid}&identifier={identifier}&usersig={usersig}&random={random}&contenttype=json")
    String sendmsg(@PathVariable("sdkappid") long sdkappid,
                   @PathVariable("identifier") String identifier,
                   @PathVariable("usersig") String usersig,
                   @PathVariable("random") long random,
                   @RequestBody JSONObject requestBody);

    /**
     * 5、全员推送中奖公告
     */
    @RequestMapping(method = RequestMethod.POST,value = "/all_member_push/im_push?sdkappid={sdkappid}&identifier={identifier}&usersig={usersig}&random={random}&contenttype=json")
    String sendAllMember(@PathVariable("sdkappid") long sdkappid,
                         @PathVariable("identifier") String identifier,
                         @PathVariable("usersig") String usersig,
                         @PathVariable("random") long random,
                         @RequestBody JSONObject requestBody);

}
